import SwiftUI

struct LocationCard: View {
    var image: Image
    var name: String
    var description: String
    var photoCount: Int
    var onTap: (() -> Void)? = nil
    
    var body: some View {
        HStack(spacing: 12) {
            image
                .resizable()
                .aspectRatio(1, contentMode: .fill)
                .frame(width: 60, height: 60)
                .clipped()
                .cornerRadius(10)
            VStack(alignment: .leading, spacing: 4) {
                Text(name)
                    .font(.headline)
                Text(description)
                    .font(.subheadline)
                    .foregroundColor(.secondary)
                    .lineLimit(2)
                Text("\(photoCount) 张照片")
                    .font(.caption)
                    .foregroundColor(.accentColor)
            }
            Spacer()
        }
        .padding(10)
        .background(Color(.systemBackground))
        .cornerRadius(14)
        .shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1)
        .onTapGesture { onTap?() }
    }
}

#Preview {
    LocationCard(image: Image(systemName: "mappin.and.ellipse"), name: "颐和园", description: "北京著名皇家园林", photoCount: 32)
        .padding()
        .frame(width: 320)
} 